package net.towee.client.event.core;

import net.towee.model.account.AccountIdentity;
import net.towee.model.repo.DocumentIdentity;

import com.google.gwt.event.shared.GwtEvent;

public class DocumentRatedEvent extends GwtEvent<DocumentRatedHandler> {
	public static Type<DocumentRatedHandler> TYPE = new Type<DocumentRatedHandler>();
	private final DocumentIdentity result;
	private final AccountIdentity account;
	private final boolean local;

	public DocumentRatedEvent(AccountIdentity author, DocumentIdentity doc, boolean local) {
		this.local = local;
		this.result = doc;
		this.account = author;
	}

	@Override
	public com.google.gwt.event.shared.GwtEvent.Type<DocumentRatedHandler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(DocumentRatedHandler handler) {
		handler.onDocumentRated(result, account, local);
	}

}
